feat: add bunny preset#4025
Conversation
|
@sandros94 is attempting to deploy a commit to the Nitro Team on Vercel. A member of the Team first needs to authorize it. |
|
Typecheck should be failing because of d3b1f7b |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new Bunny edge-scripting preset: registers the preset and types, implements the preset module and Deno runtime entry, and adds tests and test helper updates to validate build output and runtime behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/presets/bunny/runtime/edge-scripting.ts`:
- Around line 11-16: The preset for the bunny runtime is missing the unenv
configuration so process.env polyfills aren't injected; update the preset config
to include unenv: unenvDeno alongside exportConditions: ["deno"] so references
like process.env (used when computing _parsedPort and in the Deno.serve options)
are properly polyfilled at runtime. Locate the bunny runtime preset object that
currently sets exportConditions: ["deno"] (or similar) and add the unenv:
unenvDeno property to that same config.
In `@test/presets/bunny.test.ts`:
- Around line 16-29: The spawned Deno process from the execa(...) call is never
captured and therefore never killed; update the test to store the returned child
process (from execa(...)) into a variable (e.g., proc) and replace the no-op
ctx.server.close with a callback that terminates that process (e.g., proc.kill()
/ proc.kill("SIGKILL") or proc.cancel() per execa API) so the Deno process
running bunny-edge-scripting.mjs is reliably stopped when ctx.server.close() is
invoked; keep the same env/NITRO_PORT setup and use ctx.outDir to locate the
script as before.
commit: |
Backport of nitrojs#4025 to nitro v2. Adapted imports and runtime to use v2 APIs (nitropack/runtime, localFetch). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Since Bunny is compatible with crossws, let's update mention Bunny here https://nitro.build/docs/websocket |
Sorry @RihanArfan, I didn't notice your message. I'm actually waiting a bit more on promoting ws on Bunny, as there currently is an upstream issue they have to fix (in some PoP ws connections get terminated prematurely). For anyone curious here's the reproduction on which they validated the bug. Still no ETA tho |
🔗 Linked issue
Discussed privately
❓ Type of change
📚 Description
This is an experimental preset to be used on Bunny.net Edge Scripting.
The serverless platform is built ontop of Deno, with accessible pricing and ease of use, but it does come at the cost of some challanging limitations (single-file bundle artifact, 10MB max; 500ms max startup; 128MB memory; etc.), nothing that Nitro is not currently able to handle.
📝 Checklist